package se.webbzon.boltzmann.battle.battleaction.projectile;

import java.util.List;

import se.webbzon.boltzmann.battle.battleaction.BattleAction;
import se.webbzon.boltzmann.battle.object.npc.BattleNPC;
import se.webbzon.oschi01.worldarea.WorldArea;

public abstract class AbstractProjectileAction extends BattleAction implements BattleProjectileListener {
	
	// A list of all the projectiles for this projectile action
	private final List<? extends AbstractBattleProjectile> projectiles;

	/*============================================================
	Constructors
	============================================================*/
	
	public AbstractProjectileAction(WorldArea world, 
									BattleNPC caster,
									List<BattleNPC> targets,
									List<? extends AbstractBattleProjectile> projectiles) {
		super(world, caster, targets);
		this.projectiles = projectiles;
		
		for (AbstractBattleProjectile projectile : projectiles)
			projectile.addListener(this);
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	/** Returns the number of projectiles in this projectile action. **/
	public int projectiles() {
		return projectiles.size();
	}

	/** Returns the (n+1):th projectile from this projectile action. **/
	public AbstractBattleProjectile getProjectile(int n) {
		return projectiles.get(n);
	}

}
